function openPageAndInput() {
    localStorage.setItem('account', 'your_account');
    localStorage.setItem('password', 'your_password');

    const newWindow = window.open('test.html', '_blank');
    if (newWindow) {
        newWindow.focus();
        newWindow.onload = function() {
            const accountInput = newWindow.document.getElementById('account');
            const passwordInput = newWindow.document.getElementById('password');

            // Function to simulate keyboard input
            function simulateInput(inputElement, text) {
                inputElement.focus();
                for (let char of text) {
                    let event = new KeyboardEvent('keydown', { key: char, bubbles: true });
                    inputElement.dispatchEvent(event);

                    event = new KeyboardEvent('keypress', { key: char, charCode: char.charCodeAt(0), keyCode: char.charCodeAt(0), bubbles: true });
                    inputElement.dispatchEvent(event);

                    inputElement.value += char;

                    event = new KeyboardEvent('keyup', { key: char, bubbles: true });
                    inputElement.dispatchEvent(event);

                    inputElement.dispatchEvent(new Event('input', { bubbles: true }));
                }
            }

            simulateInput(accountInput, localStorage.getItem('account'));
            simulateInput(passwordInput, localStorage.getItem('password'));

            console.log('Form filled:', accountInput.value, passwordInput.value);
        };
    } else {
        console.error('Failed to open new window');
    }
}